package Text_31;

import java.util.Random;

public class Code {

	public static void main(String[] args) {
		//验证码
		Random r = new Random();
		//定义字符数组
        char[] ch = new char[52];
        //存入字母
        for (int i = 0; i < ch.length; i++) {
        	//小写字母
            if(i<=25){
                ch[i] = (char)(97+i);
            }else {
            	//大写字母
                ch[i] = (char)(65+i-26);
            }

        }
        String re = "";
        
        for (int j = 0; j <4 ; j++) {
        	//随机获取四个字母
            int a = r.nextInt(ch.length);
            re = re+ch[a] ;
        }
        int i = r.nextInt(10);
        //字母数字拼接
        re = re + i;
        System.out.print("验证码为"+re+" ");

	}

}
